<template>
  <div class="auth-page">
    <div class="container page">
      <div class="row">
        <div class="col-md-6 offset-md-3 col-xs-12">
          <h1 class="text-xs-center">Sign up</h1>
          <p class="text-xs-center">
            <a href="">Have an account?</a>
          </p>

          <ul class="error-messages">
            <li v-for="(value, key) in errors" :key="key">
              {{ key }} {{ value[0] }}
            </li>
          </ul>

          <form @submit.prevent="handleLogin">
            <!-- <fieldset class="form-group">
              <input
                class="form-control form-control-lg"
                type="text"
                placeholder="Your Name"
              />
            </fieldset> -->
            <fieldset class="form-group">
              <input
                v-model="user.email"
                class="form-control form-control-lg"
                type="text"
                placeholder="Email"
              />
            </fieldset>
            <fieldset class="form-group">
              <input
                v-model="user.password"
                class="form-control form-control-lg"
                type="password"
                placeholder="Password"
              />
            </fieldset>
            <button class="btn btn-lg btn-primary pull-xs-right">
              Sign up
            </button>
          </form>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import useLogin from './composables/useLogin'

export default {
  name: 'LoginIndex',

  // 这里没有 this
  setup () {
    const { user, handleLogin, errors } = useLogin()
    return {
      user,
      handleLogin,
      errors
    }
  }
  // data () {
  //   return {}
  // },
  // computed: {},
  // mounted () {},
  // methods: {}
}
</script>

<style>
</style>
